
rem
bbdoc: Transform describes scale and rotation.
end rem
Type TTransformComponent Extends TComponent {expose hidefields}
	
	Field _rotation:Float
	Field _scaleX:Float
	Field _scaleY:Float
	

	Method New() {hidden}
		_rotation = 0.0
		_scaleX = 1.0
		_scaleY = 1.0
	End Method
	
	
	Rem
	bbdoc: Convenience constructor.
	endrem
	Function Create:TTransformComponent(scaleX:Float = 1.0, scaleyY:Float = 1.0, rotation:Float = 0.0) {hidden}
		Local t:TTransformComponent = New TTransformComponent
		t.SetScale(scaleX, scaleyY)
		t.SetRotation(rotation)
		Return t
	End Function
	
	
	rem
	bbdoc: Returns rotation value.
	endrem	
	Method GetRotation:Float()
		Return _rotation
	End Method
	
	
	rem
	bbdoc: Sets rotation value.
	endrem
	Method SetRotation(r:Float)
		_rotation = r
	End Method
		
	
	rem
	bbdoc: Sets scale value.
	endrem
	Method SetScale(x:Float, y:Float)
		_scaleX = x
		_scaleY = y
	End Method
	
	
	rem
	bbdoc: Returns scale X value.
	endrem	
	Method GetScaleX:Float()
		Return _scaleX
	End Method
	

	rem
	bbdoc: Returns scale Y value.
	endrem	
	Method GetScaleY:Float()
		Return _scaleY
	End Method
	
		
	rem
	bbdoc: Adds specified degrees to current rotation value.
	endrem	
	Method AddRotation(degree:Float)
		_rotation = (_rotation + degree) Mod 360
	End Method
	

	rem
	bbdoc: Applies scale and rotation.
	endrem	
	Method Apply()
		brl.max2d.SetScale(_scalex, _scaley)
		brl.max2d.SetRotation(_rotation)
	End Method
	
End Type

